Skip to content

Adopt latest design tokens + future-proof TokenLoader for multi-mode collections#89

Closed
khoinguyen-mindera wants to merge 6 commits into
mainfrom
claude/affectionate-hodgkin-b608a2
Closed

Adopt latest design tokens + future-proof TokenLoader for multi-mode collections#89
khoinguyen-mindera wants to merge 6 commits into
mainfrom
claude/affectionate-hodgkin-b608a2

Conversation

@khoinguyen-mindera

Copy link
Copy Markdown
Contributor

Warning

Draft — blocked on two prerequisites. Do not merge until both are resolved:

  1. Merge Mindera/Alfie-Mobile-Design-Tokens#1 first. This PR's token JSON was pulled from that PR's branch (feat/figma-plugin-export-tool); it must land on that repo's main before this can be re-pulled from a stable source.
  2. Fix a Figma binding. The app target currently does not compile — see "Known blocker" below.

What changed

Two logical commits:

  1. feat: future-proof TokenLoader mode selectionTools/DesignTokenGen

    • Pins the theme collection to the alfie-theme mode (it gained a second brand mode, selfridges, which iOS doesn't ship).
    • Any future unpinned collection that gains a second mode now fails fast with an actionable message ("add a pin to modeForCollection") instead of a cryptic fileNotFound downstream.
    • Adds regression tests for both behaviors (41 tests pass). This commit compiles and is independently sound.
  2. chore: adopt latest design tokensSharedUI/DesignTokens + GeneratedTokens

    • Re-pulled token JSON from the in-house figma-plugin/ export (replaces the old third-party-plugin export).
    • Font-weight primitives are now correctly typed fontWeight (previously filtered out entirely) and font-family primitives typed fontFamily, so generated Swift references them as symbols (e.g. fontWeight: Primitives.Typography.fontWeightRegular) instead of inlining literals like 400.

Known blocker (why the app doesn't compile yet)

Typography+Generated.swift for body-medium-strikethrough emits:

fontWeight: Primitives.Typography.fontFamilyPrimaryIos   // String, but TypographyStyle.fontWeight is Int

This is not a codegen bug — the generator faithfully reflects Figma, where body-medium-strikethrough's font-weight is mis-bound to a font-family variable. The correct-typing improvement above simply made this pre-existing mistake visible (it was previously flattened to a silent 400). It resolves once the Figma binding is fixed and tokens are re-pulled. Three sibling styles (body-large, display-small, heading-x-small) are also bound to the wrong style's weight variable but currently resolve to a coincidentally-correct value; worth fixing in the same pass.

Test plan

  • Tools/DesignTokenGen unit tests pass (41 tests), including new multi-mode regression tests
  • ./Alfie/scripts/verify.shfails at build on the known body-medium-strikethrough type mismatch; will pass once the Figma binding is fixed

@khoinguyen-mindera
khoinguyen-mindera marked this pull request as ready for review July 7, 2026 06:28
Copilot AI review requested due to automatic review settings July 7, 2026 06:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the design-token pipeline and token payloads to support multi-mode collections safely (pinning iOS-relevant modes) while adopting the latest exported tokens and regenerated Swift token accessors.

Changes:

  • Updated TokenLoader to pin the theme collection to alfie-theme and to fail fast when an unpinned collection becomes multi-mode, with new regression tests.
  • Replaced/adopted updated design token JSON exports (including newly typed fontWeight / fontFamily primitives).
  • Regenerated Swift token accessors under SharedUI/GeneratedTokens to reflect the new token schema/content.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
Tools/DesignTokenGen/Tests/DesignTokenGenCoreTests/GeneratorTests.swift Adds regression tests for theme mode pinning and unpinned multi-mode fast-fail behavior.
Tools/DesignTokenGen/Tests/DesignTokenGenCoreTests/Fixtures/mini/manifest.json Extends fixture manifest with a second theme mode (selfridges) for regression coverage.
Tools/DesignTokenGen/Sources/DesignTokenGenCore/TokenLoader.swift Pins theme mode selection and adds explicit fast-fail for unpinned multi-mode collections.
Alfie/AlfieKit/Sources/SharedUI/GeneratedTokens/Typography+Generated.swift Regenerated typography tokens; currently contains a compile-breaking type mismatch for mediumStrikethrough.
Alfie/AlfieKit/Sources/SharedUI/GeneratedTokens/Theme+Generated.swift Regenerated theme tokens to include newly exported theme surfaces (e.g., button states, borders).
Alfie/AlfieKit/Sources/SharedUI/GeneratedTokens/Primitives+Generated.swift Regenerated primitives, including fontWeight symbols and normalized numeric literals.
Alfie/AlfieKit/Sources/SharedUI/DesignTokens/typography.styles.tokens.json Updates typography style definitions; currently contains incorrect font-weight bindings for some styles.
Alfie/AlfieKit/Sources/SharedUI/DesignTokens/typography.alfie-theme.tokens.json Updates underlying typography tokens and introduces typed font-weight primitives.
Alfie/AlfieKit/Sources/SharedUI/DesignTokens/theme.alfie-theme.tokens.json Updates theme token definitions (expanded button/state tokens, borders, etc.).
Alfie/AlfieKit/Sources/SharedUI/DesignTokens/system.ios.tokens.json Updates system token exports (ordering + additional system fields like os).
Alfie/AlfieKit/Sources/SharedUI/DesignTokens/sizing.alfie-theme.tokens.json Updates sizing token exports (reordering + interactive padding tokens).
Alfie/AlfieKit/Sources/SharedUI/DesignTokens/screen-size.small-(s).tokens.json Updates screen-size small mode tokens (reordering/grouping).
Alfie/AlfieKit/Sources/SharedUI/DesignTokens/manifest.json Updates manifest collections/modes and adds theme.selfridges mode to the theme collection.
Alfie/AlfieKit/Sources/SharedUI/DesignTokens/.primitives.alfie-theme.tokens.json Updates primitive exports and adds typed font-weight primitives that were previously missing.
Alfie/AlfieKit/Sources/SharedUI/DesignTokens/.broken-ref-allowlist.json Clears previously allow-listed missing font-weight primitives and updates the fix strategy note.

Comment thread Tools/DesignTokenGen/Tests/DesignTokenGenCoreTests/GeneratorTests.swift Outdated
Comment thread Alfie/AlfieKit/Sources/SharedUI/DesignTokens/typography.styles.tokens.json Outdated
Comment thread Alfie/AlfieKit/Sources/SharedUI/DesignTokens/typography.styles.tokens.json Outdated
Comment thread Alfie/AlfieKit/Sources/SharedUI/DesignTokens/typography.styles.tokens.json Outdated
Comment thread Alfie/AlfieKit/Sources/SharedUI/DesignTokens/typography.styles.tokens.json Outdated
@khoinguyen-mindera

Copy link
Copy Markdown
Contributor Author

Both blockers resolved — this is now ready for review.

  1. Mindera/Alfie-Mobile-Design-Tokens#1 is merged to main.
  2. The Figma font-weight bindings are fixed; tokens were re-pulled from main (not the feature branch), so body-medium-strikethrough now correctly emits fontWeight: Primitives.Typography.fontWeightRegular.

Rebased onto the latest branch state (which now includes ALFMOB-266 — the Typography call-site migration), regenerated, and ./Alfie/scripts/verify.sh --skip-integration passes (✅ VERIFICATION PASSED — build + unit tests).

@khoinguyen-mindera

Copy link
Copy Markdown
Contributor Author

Superseded by #91 — the same commits were re-homed onto feat/ALFMOB-264-adopt-design-tokens (off current main) and the tokens confirmed reproducible from upstream main. Closing this draft.

@khoinguyen-mindera
khoinguyen-mindera deleted the claude/affectionate-hodgkin-b608a2 branch July 8, 2026 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants